import cv2 as cv
import os

BASE_DIR, FILE_NAME = os.path.split(__file__)

dir = '../../../../large_data/pic/webp'
IMG_DIR = os.path.join(BASE_DIR, dir)

files = os.listdir(IMG_DIR)
for file in files:
    base, ext = os.path.splitext(file)
    if ext != '.webp':
        continue
    file_path = os.path.join(IMG_DIR, file)
    print(file_path)
    img = cv.imread(file_path)
    new_path = os.path.join(IMG_DIR, base + '.jpg')
    cv.imwrite(new_path, img)
    print(new_path)
